Skip to content


ardupilot  None  ros2  dds  micro ros  xrce  lua  sitl  scripts  plugin  gazebo  garden  SITL  debug  rangefinder  pymavlink  mavros  distance sensor  system_time  timesync  ardurover  cheat sheet  mission planner  cmake  gtest  ctest  101  cpp  c++  format  fmt  multithreading  spdlog  cyclonedds  eprosima  fastdds  aptly  apt  repository  repo  local  mirror  encryption  pgp  docker  arm  container  state  networking  network  nvidia  python  app  devcontainer  gui  tutorial  tips  volume  mount  compose  multi-stage  stage  docker compose  microsoft  dotnet  .net  c#  vscode  git  bundle  backup  submodules  github  hooks  pre-commit  lxd  lxc  x11  profile  marpit  presentation  marp  markdown  mermaid  mkdocs  video  ffmpeg  gstreamer  cheat-sheet  sdp  opencv  appsrc  appsink  acceleration  va-api  intel  v4l2loopback  pipe  compositor  alpha  shmsink  shmsrc  intersink  intersrc  tee  queue  udp  stream  gi  kml  geo  gis  spatial  gdal  ogr  raster  vector  snippets  cheat Sheet  asyncio  event  future  thread  task  can  canbus  click  cli  cupy  numpy  gpu  dataclass  slots  dev container  fastapi  rest  uvicorn  deb  debian  package  setup  stdeb  project  jupyter  widgets  interactive  plot  matplotlib  ipywidgets  3d  subplot  open3d  point cloud  template  black  isort  templates  cookiecutter  docs  project document  docstrings  flake8  linter  git-hook  mypy  unittest  pytest  pylint  from a-z  fixture  scope  logging  pytest.ini  mock  parameterize  enum  flag  iterator  generator  yaml  yml  logging config  tuple  namedtuple  typing  annotation  generic  literal  protocol  self  typed dict  typevar  pyzmq  zmq  msgpack  slam  cartographer  slam_toolbox  action  namespace  remap  control2  demo  diff-drive  ignition  ros2_control  effort  velocity  gdb  qos  tag  plugins  msg  node  zero-copy  shm  algorithm  calibration  diff  pid  dev  colcon  colcon_cd  settings  behavior  py_trees  bt  behavior_trees  blackboard  visualization  debugging  diagnostic  DiagnosticTask  diagnostics  tutorials  gst  math  apm  rat_runtime_monitor  mavlink  bag  rosbag  rosbags  tools  ros  web  rosbridge  vue  binding  discovery  gazebo-classic  launch  spawn  model  cook  camera  sensors  gps  imu  ray  gazebo_ros_ray_sensor  lidar  ultrsonic  range  ultrasonic  gazebo classic  wrench  gz  sdf  world  vscode tips  gazebogz-sim-joint-position-controller-system  bridge  simulation  ros_gz_bridge  ign  xacro  diff_drive  odom  odometry  joint_state  argument  OpaqueFunction  DeclareLaunchArgument  LaunchConfiguration  tmux  nav  nav2  turtlebot  perception  test  rclpy  goal abort  cancel goal  action client  action server  custom messages  executor  MultiThreadedExecutor  SingleThreadedExecutor  param  dynamic-reconfigure  service  client  setup.py  package.xml  parameter  parameters  custom  msgs  executers  pub  sub  rqt  rviz  rviz2  pose  marker  tf2  local_setup  rosdep  package manager  project settings  vcstool  urdf  robot_state_publisher  urdf_to_graphiz  joint  link  zenoh  tags  hands on  webinar  deep learning  ai  beginner  regression  reinforcement learning  q learning  gym  gymnasium  deepsort  build  source  wheel  cuda  vision  siam-mask  tracking  segmentation  yolo  ultralytics  cross-compiler  esp32  nano  jetson  i2c  adafruit  arduino  sensor  mb1202  uart  serial  tfmini  rpi  raspberry pi  arducam  teensy  microros  micro python  embedded  pymakr  config  material  workshope  texture  joints  tmuxp  loop device  rootfs  zah  linux  rm  ubuntu  sudo  sudoers  nopasswd  visudo  udev  key  gpg  sign  commands  update-alternative  dpkg  ip  ss  netstat  snap  deploy  ssh  systemd  socat  tc  mtu  select  robotics  path planning  trajectory  speed  pcl  kalman_filter  kalman  filter  control  code  extensions  remote  json  schema  yocto  poky  qemu  projects  courses to follow  matrix  graphics  rotation  2d  course  drone  quad  uav  design  vrx  buoyancy 

Ardupilot SITL with Gazebo simulator#

Objective#

Run Ardupilot (copter) SITL and gazebo simulation

  • Gazebo garden
  • ardupilot_gazebo (plugin)
  • MAVProxy

ardupilot_gazebo#

# Clone ardupilot_gazebo repository
# git subfolder

mkdir ~/git
cd git
# git clone -b <branchname> <remote-repo-url>
git clone https://github.com/ArduPilot/ardupilot_gazebo.git

Install#

more

sudo apt update
sudo apt install libgz-sim7-dev rapidjson-dev
cd aurdupilot_gazebo
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4

Run#

terminal1
export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/git/ardupilot_gazebo/build:${GZ_SIM_SYSTEM_PLUGIN_PATH}
export GZ_SIM_RESOURCE_PATH=$HOME/git/ardupilot_gazebo/models:$HOME/git/ardupilot_gazebo/worlds:${GZ_SIM_RESOURCE_PATH}

# note remove sky tag from sdf
gz sim -v 4 -r iris_runway.sdf

-r: run simulation on start -v 4: verbose mode

SITL#

sim_vehicle#
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console
Manual#
terminal2 - run SITL
./arducopter -S --model JSON \
--speedup 1 \
--defaults copter.parm,gazebo-iris.parm \
-I0

MAVProxy#

mavproxy
mavproxy.py --master tcp:127.0.0.1:5760

# Arm and takeoff
mode guided
arm throttle
takeoff 5


Basic Worlds and models#

iris_with_ardupilot iris_with_standoff, liftdrag and ardupilot plugins
iris_with_gimbal iris_with_standoff, gimbal_small_2d, liftdrag and ardupilot plugins
gimbal_small_2d Camera sensor declare on tilt_link

Note

In my computer the sky flickering so i comments them

<scene>
  <ambient>1.0 1.0 1.0</ambient>
  <background>0.8 0.8 0.8</background>
  <!-- <sky></sky> -->
</scene>

Note

Change model to iris_with_gimbal

<include>
  <uri>model://iris_with_gimbal</uri>
  <pose degrees="true">0 0 0 0 0 90</pose>
</include>

by default camera topic name generate by sensor location

/world/iris_runway/model/iris_with_gimbal/model/gimbal/link/tilt_link/sensor/camera/image
#

Reference#